package com.nutrition.health.controller;

import com.nutrition.health.model.KGNode;
import com.nutrition.health.service.KGService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.List;

@RestController
@RequestMapping("/kg")
public class KGController {

    @Autowired
    private KGService kgService;

    @GetMapping("/food")
    public Map<String, Object> getFoodKGData(@RequestParam String name) {
        return kgService.getFoodKGData(name);
    }

    @GetMapping("/all")
    public Map<String, Object> getAllKGData() {
        return kgService.getAllKGData();
    }
    
    @GetMapping("/search")
    public List<KGNode> searchFoods(@RequestParam String keyword) {
        return kgService.searchFoodsByKeyword(keyword);
    }
}